package com.springboot.demo.dao;

import com.springboot.db.entity.User;
import com.springboot.db.entity.UserExample;
import com.springboot.db.mapper.UserMapper;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 用户dao实现类
 *
 * @author supu
 * @create 2018-12-13 10:56
 **/
@Service
public class UserDaoImpl implements UserDao{
    @Autowired
    private UserMapper userMapper;


    @Override
    public List<User> selectUsers() {
        UserExample example = new UserExample();
        UserExample.Criteria criteria = example.createCriteria();
        criteria.andIdLessThan(3);
        return userMapper.selectByExample(example);
    }

    @Override
    public void saveUser(User user) {
        userMapper.insertSelective(user);
    }
}
